//
//  VerticalCollectionViewCell.m
//  WWAVPlayer
//
//  Created by dllo on 15/10/30.
//  Copyright © 2015年 LZY. All rights reserved.
//

#import "VerticalCollectionViewCell.h"

@implementation VerticalCollectionViewCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.myImageView = [[UIImageView alloc] init];
        
        self.titleLabel = [[UILabel alloc] init];
        
        self.titleLabel.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.3];
        
        self.titleLabel.textColor = [UIColor whiteColor];
       
        self.titleLabel.font = [UIFont systemFontOfSize:14];
        self.detailLabel = [[UILabel alloc] init];
        
        self.detailLabel.font = [UIFont systemFontOfSize:14];
        
        self.detailLabel.numberOfLines = 0;
        
        [self.detailLabel sizeToFit];
        
        [self.contentView addSubview:self.myImageView];
        [self.contentView addSubview:self.detailLabel];
        [self.myImageView addSubview:self.titleLabel];
    }
    return self;
}
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    self.myImageView.frame = CGRectMake(10, 5 ,layoutAttributes.bounds.size.width - 20 , layoutAttributes.bounds.size.height -5 - 30);
    
    self.detailLabel.frame = CGRectMake(10, layoutAttributes.bounds.size.height  - 20 - 10,layoutAttributes.bounds.size.width - 20 ,  30);
    
    self.titleLabel.frame = CGRectMake(0, layoutAttributes.bounds.size.height - 30 - 5 - 20 , layoutAttributes.bounds.size.width - 20, 20);
    
}
@end
